/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.easoftware.code.beans.jpa;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author waumovil-javaengineer
 */
@Entity
@Table(name = "cargadatos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cargadatos.findAll", query = "SELECT c FROM Cargadatos c"),
    @NamedQuery(name = "Cargadatos.findById", query = "SELECT c FROM Cargadatos c WHERE c.id = :id"),
    @NamedQuery(name = "Cargadatos.findByFecha", query = "SELECT c FROM Cargadatos c WHERE c.fecha = :fecha"),
    @NamedQuery(name = "Cargadatos.findByPathArchivo", query = "SELECT c FROM Cargadatos c WHERE c.pathArchivo = :pathArchivo"),
    @NamedQuery(name = "Cargadatos.findByMes", query = "SELECT c FROM Cargadatos c WHERE c.mes = :mes"),
    @NamedQuery(name = "Cargadatos.findByAnio", query = "SELECT c FROM Cargadatos c WHERE c.anio = :anio")})
public class Cargadatos implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Size(max = 100)
    @Column(name = "path_archivo")
    private String pathArchivo;
    @Column(name = "mes")
    private Integer mes;
    @Column(name = "anio")
    private Integer anio;
    @OneToMany(cascade = CascadeType.REMOVE, mappedBy = "cargadatos")
    private Collection<OrdencaStore> ordencaStoreCollection;
    @OneToMany(cascade = CascadeType.REMOVE, mappedBy = "cargadatos")
    private Collection<AsoffStore> asoffStoreCollection;
    @JoinColumn(name = "usuarioresponsable", referencedColumnName = "usuario")
    @ManyToOne
    private Usuario usuarioresponsable;
    @OneToMany(cascade = CascadeType.REMOVE, mappedBy = "cargadatos")
    private Collection<VentacaStore> ventacaStoreCollection;
    @OneToMany(cascade = CascadeType.REMOVE, mappedBy = "cargadatos")
    private Collection<OrdenretenidacaStore> ordenretenidacaStoreCollection;
    @OneToMany(cascade = CascadeType.REMOVE, mappedBy = "cargadatos")
    private Collection<ChequerechazadocaStore> chequerechazadocaStoreCollection;

    public Collection<ChequerechazadocaStore> getChequerechazadocaStoreCollection() {
        return chequerechazadocaStoreCollection;
    }

    public void setChequerechazadocaStoreCollection(Collection<ChequerechazadocaStore> chequerechazadocaStoreCollection) {
        this.chequerechazadocaStoreCollection = chequerechazadocaStoreCollection;
    }

    public Cargadatos() {
    }

    public Cargadatos(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getPathArchivo() {
        return pathArchivo;
    }

    public void setPathArchivo(String pathArchivo) {
        this.pathArchivo = pathArchivo;
    }

    public Integer getMes() {
        return mes;
    }

    public void setMes(Integer mes) {
        this.mes = mes;
    }

    public Integer getAnio() {
        return anio;
    }

    public void setAnio(Integer anio) {
        this.anio = anio;
    }

    @XmlTransient
    public Collection<OrdencaStore> getOrdencaStoreCollection() {
        return ordencaStoreCollection;
    }

    public void setOrdencaStoreCollection(Collection<OrdencaStore> ordencaStoreCollection) {
        this.ordencaStoreCollection = ordencaStoreCollection;
    }

    @XmlTransient
    public Collection<AsoffStore> getAsoffStoreCollection() {
        return asoffStoreCollection;
    }

    public void setAsoffStoreCollection(Collection<AsoffStore> asoffStoreCollection) {
        this.asoffStoreCollection = asoffStoreCollection;
    }

    public Usuario getUsuarioresponsable() {
        return usuarioresponsable;
    }

    public void setUsuarioresponsable(Usuario usuarioresponsable) {
        this.usuarioresponsable = usuarioresponsable;
    }

    @XmlTransient
    public Collection<VentacaStore> getVentacaStoreCollection() {
        return ventacaStoreCollection;
    }

    public void setVentacaStoreCollection(Collection<VentacaStore> ventacaStoreCollection) {
        this.ventacaStoreCollection = ventacaStoreCollection;
    }

    @XmlTransient
    public Collection<OrdenretenidacaStore> getOrdenretenidacaStoreCollection() {
        return ordenretenidacaStoreCollection;
    }

    public void setOrdenretenidacaStoreCollection(Collection<OrdenretenidacaStore> ordenretenidacaStoreCollection) {
        this.ordenretenidacaStoreCollection = ordenretenidacaStoreCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += ( id != null ? id.hashCode() : 0 );
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!( object instanceof Cargadatos )) {
            return false;
        }
        Cargadatos other = (Cargadatos) object;
        if (( this.id == null && other.id != null ) || ( this.id != null && !this.id.equals(other.id) )) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.easoftware.code.beans.jpa.Cargadatos[ id=" + id + " ]";
    }
}
